#include "./camion.c"


#define MAX_CAMION 100

camion[] init_EDT()
{
  FILE *f;
  event *E;
  camion *Tab[MAX_CAMION];

  char *count_e; //nb event
  f = fopen("nb_event.bin","rb");
  fread(count_e, sizeof(char*), 1, f);
  fclose(f);

  char *count_c; //nb_camion
  f = fopen("nb_camion.bin","rb");
  fread(count_c, sizeof(char*), 1, f);
  fclose(f);
  
  //chargement des camions
  for(int i = 0; i <= nb_camion_int; i++) //debut a 1
    {
      Tab[i] = read_camion(count_c);
    }

  //chargement des events
  for(int i = 0; i <= nb_event_int; i++) // debut a 1
    {      
      E = read_event(count_e);
      
      for(int i = 0; i < nb_camion_int; i++)
	{
	  if( strcmp(E->camion, Tab[i]->name) == 0)
	    add_to_camion(Tab[i], E);
	}
    }

  return Tab;
}





